package com.example.demo.joone.demo1;

/**
 * @Create: IntelliJ IDEA.
 * @Author: subtlman_ljx
 * @Date: 2022/10/13/14:42
 * @Description: Java实现深度神经网络：Sigmoid层
 */
public class Sigmoid {
    public Sigmoid() {

    }

    public double[] out(double[] x) {
        double[] out = new double[x.length];
        for (int i = 0; i < x.length; i++) {
            out[i] = sigmoidF(x[i]);
        }
        return out;
    }

    private double sigmoidF(double x) {
        return 1f / (1f + Math.pow(Math.E, -1 * x));
    }

    /**
     * 由方法sigmoidF决定
     * 其内部执行的方法体为math相关的数学运算
     *
     */
}
